sv2-tp: exit on bitcoin core IPC disconnect#100
Open
enirox001 wants to merge 2 commits intostratum-mining:masterfrom
Open
sv2-tp: exit on bitcoin core IPC disconnect#100enirox001 wants to merge 2 commits intostratum-mining:masterfrom
enirox001 wants to merge 2 commits intostratum-mining:masterfrom
Conversation
Catch IPC exceptions from mining calls in the template provider and mark the backend as disconnected when they occur. This lets sv2-tp distinguish a fatal backend disconnect from a normal shutdown and unwind its worker threads without making further IPC calls on a dead connection.
Exit sv2-tp with failure when the template provider reports that its Bitcoin Core IPC backend has disconnected. This makes backend loss visible to process supervisors while preserving EXIT_SUCCESS for operator-initiated shutdowns.
Collaborator
|
Why not just try to reconnect with exponential backoff? |
Author
Reconnecting with exponential backoff is the preferable behavior. I am working on this approach This PR was opened to make the smaller exit-on-disconnect approach concrete in case that behavior was considered acceptable. It is a narrower change and avoids introducing reconnect and backend-lifecycle management into the current sv2-tp design. This can be treated as a reference point for the simpler shutdown path rather than the proposed final direction. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes sv2-tp remaining alive but unusable after losing its Bitcoin Core IPC backend.
Catch
ipc::Exceptionfrom template provider mining calls, mark the backend as disconnected, interrupt local threads, and letmainexit with failure when backend loss is detected.This takes the simpler shutdown path instead of trying to reconnect in-process. It avoids introducing backend swapping or reconnect state into the current sv2-tp lifecycle, and lets an external supervisor handle restart.
Before this change, stopping Bitcoin Core left sv2-tp running with open sockets but no ability to serve templates. After this change, sv2-tp shuts down and exits nonzero on backend disconnect, while preserving
EXIT_SUCCESSfor normal operator shutdown.Tested manually on regtest by: